#define _CRT_SECURE_NO_WARNINGS 1

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */

typedef struct ListNode ListNode;

struct ListNode* middleNode(struct ListNode* head) {
    ListNode* src, * dest;
    src = dest = head;
    while (dest && dest->next)
    {
        src = src->next;
        dest = dest->next->next;
    }
    return src;
}